<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<%@ include file="common.jsp"%>

<div class="page-sidebar-wrapper">
    <div class="page-sidebar navbar-collapse collapse">
        <ul id="menuBody" class="page-sidebar-menu" data-auto-scroll="true"
            data-slide-speed="200">
             
        </ul>
    </div>
</div>

<style>
<!--
	img.icon{
		width:16px;
		height:16px;
		margin-right:5px;
	}
-->
</style>

<script type="text/javascript">

    var reLoadData = null;
    $(function() {
        $.ajax({
             url : '${contextPath }/function/menus?roleId=1',
             type : 'GET',
             success : function(result) {
                 var html = '';
                 $("#menuBody").html('');
                 html += '<li class="sidebar-toggler-wrapper">';
                 html += '<div class="sidebar-toggler hidden-phone">';
                 html += '</div>';
                 html += '</li>';
                 //html += '<li class="start active ">';
                 //html += '<a data-trigger="ajax" href="./admin/user_list" data-target="#main-content">';
                 //html += '<i class="fa fa-home"></i>';
                 //html += '<span class="title"> 快捷操作面板 </span>';
                 //html += '<span class="selected"> </span>';
                 //html += '</a></li>';
                 var menus = result.data;
                 
                 // for (var i = 0; i < menus.length; i++) {
                 //     var menu = menus[i];
                 //     if (menu.pCode == '0') {
                 //         html += ' <li>';
                 //         html += ' <a href="javascript:;">'; 
                 //         //html += ' <i class="fa '+menu.icon+'"></i>';
                 //         html += ' <img class="icon" src="${contextPath }/resources/assets/img/'+menu.icon+' " />';
                 //         html += ' <span class="title">' + menu.title + '</span>';
                 //         html += ' <span class="arrow"></span>';
                 //         html += ' </a> <ul class="sub-menu">';  
                 //         for (var j = 0; j < menus.length; j++) {
                 //             if (menus[j].pCode == menu.code) {//<i class="fa '+menus[j].icon+'"></i>
                 //                 html += ' <li><a class="menu_button" href="${contextPath }'+menus[j].url+'?source=left"><img class="icon" src="${contextPath }/resources/assets/img/'+menus[j].icon+' " />'
                 //                         + menus[j].title + '</a></li> ';
                 //             }
                 //         }
                 //         html += ' </ul></li>';
                 //     }
                 // } 
                 
                 $("#menuBody").html(html);
                 $('.menu_button').click(function(event){
                	var href = $(this).attr('href');
                	$('#main-content').html('');
                	$("#main-content").load(href);
         			
         			event.preventDefault();  // 对于event事件上的对象，防止以链接打开 URL：例如，当点击提交按钮时阻止对表单的提交 
                 });
             }
         });

      

    });
</script>

